Fix clearTaskInstances API: Restore include_past/future support on UI#54416
Fix clearTaskInstances API: Restore include_past/future support on UI#54416pierrejeambrun merged 14 commits intoapache:mainfrom
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
pierrejeambrun
left a comment
There was a problem hiding this comment.
Nice thanks.
A few comments to address before we can merge.
Also I just started the CI and it will need fixing (code formatting etc...)
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
|
@pierrejeambrun |
pierrejeambrun
left a comment
There was a problem hiding this comment.
Can you please fix the CI?
Tested locally, looks good. Just a few things to adjust, we can merge then.
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py
Outdated
Show resolved
Hide resolved
3eddcd7 to
cd79bc1
Compare
|
Issue here #55267 |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Backport failed to create: v3-0-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker f5d0b17 v3-0-testThis should apply the commit to the v3-0-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continue |
|
Manual backport #55272 |
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>
…apache#54416) * Fix clearTaskInstances API: Restore include_past/include_future support on UI * style: fix formatting * chore: fix typo * chore: remove comment * chore: fix comment DX to TX * refactor: remove verbose handling future or past * refactor: remove verbose handling future or past * refactor: use hardcoded test result * fix(test_task_instances.py): correct test comment * fix(test_task_instances.py): fix typo * fix(test_task_instances.py): fix typo * fix(task_instances.py): make sure start_date, end_date to None * fix(task_instances.py): fix inaccurate response * fix(task_instances.py): fix inaccurate response --------- Co-authored-by: bggwak <bggwak@hyundai.com>


This PR resolves the issue reported in #54134, where attempting to clear task instances from the Airflow UI using both dag_run_id and include_past/include_future resulted in a 400 error. This prevented users from clearing past or future task instances via the UI, which was possible in previous Airflow versions.
With this fix:
The API now correctly allows the use of include_past/include_future together with dag_run_id, as long as the DAG run has a valid logical_date (i.e., for scheduled DAG runs).
For manually triggered DAG runs (where logical_date is None), the API still returns a 400 error to protect against accidental clearing of unrelated task instances—preventing the original bug from resurfacing.
closes: #54134